import uvicorn
import sys
sys.path.append("../")
sys.path.append("./service")

from fastapi import FastAPI, APIRouter
from controller.MainController import MainController

app = FastAPI()
# image_controller = ImageController(APIRouter(prefix="/api/v1/image", tags=['custom']))
# 要调用service的方法的格式；
# http://127.0.0.1:8000/ + /api +/方法名
main_controller = MainController(APIRouter(prefix="/api", tags=['api']))

# 将controller的路由注册到app中
# app.include_router(image_controller.router)
app.include_router(main_controller.router)


@app.get("/")
async def root():
    return {"message": "This is computational-sharding server."}

if __name__ == '__main__':
    # uvicorn.run("app:app", host="0.0.0.0", port=8085, reload=True)
    uvicorn.run("app:app", host="0.0.0.0", port=20000, reload=False)
